旋转(Rotation)矩阵转欧拉角(euler) | 您所在的位置:网站首页 › matlab 旋转矩阵 欧拉角 › 旋转(Rotation)矩阵转欧拉角(euler) |
文章目录
摘要Rotation matricesGeneralized rotation matricesFinding two possible angles for
θ
\theta
θFind the corresponding angles of
ψ
\psi
ψFinding the corresponding angles of
ϕ
\phi
ϕTwo solutions if
cos
θ
≠
0
\cos \theta \ne 0
cosθ=0What if
cos
θ
=
0
\cos \theta=0
cosθ=0?Pseudo-codeMore than one solutionreference
摘要
本文档讨论了从旋转矩阵中找所有可能欧拉角的简单技术。在计算机图形学、视觉,机器人和动力学中,有时候欧拉角的确定是必须的一步。然而,它的解可能不是那么的显而易见。 paper: Computing Euler angles from a rotation matrix author:Gregory G. Slabaugh Rotation matrices我们从绕三个主轴旋转的标准定义开始。 绕x轴旋转 ψ \psi ψ弧度可定义为 R x ( ψ ) = [ 1 0 0 0 cos ψ − s i n ψ 0 sin ψ cos ψ ] R_x(\psi) = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos \psi & -sin \psi \\ 0 & \sin \psi & \cos \psi \end{bmatrix} Rx(ψ)=⎣⎡1000cosψsinψ0−sinψcosψ⎦⎤ 与此类似,绕y轴旋转 θ \theta θ弧度可定义为 R y ( θ ) = [ cos θ 0 s i n θ 0 1 0 − sin θ 0 cos θ ] R_y(\theta) = \begin{bmatrix} \cos \theta & 0 & sin \theta \\ 0 & 1 & 0 \\ -\sin \theta & 0 & \cos \theta \end{bmatrix} Ry(θ)=⎣⎡cosθ0−sinθ010sinθ0cosθ⎦⎤ 最后,绕z轴旋转 ϕ \phi ϕ弧度可定义为 R z ( ϕ ) = [ cos ϕ − sin ϕ 0 sin ϕ cos ϕ 0 0 0 1 ] R_z(\phi) = \begin{bmatrix} \cos \phi & -\sin \phi & 0 \\ \sin \phi & \cos \phi & 0 \\ 0 & 0 & 1 \end{bmatrix} Rz(ϕ)=⎣⎡cosϕsinϕ0−sinϕcosϕ0001⎦⎤ 角 ψ , θ , ϕ \psi, \theta, \phi ψ,θ,ϕ是欧拉角。 Generalized rotation matrices旋转矩阵一般可以写成 R = [ R 11 R 12 R 13 R 21 R 22 R 23 R 31 R 32 R 33 ] R = \begin{bmatrix} R_{11} & R_{12} & R_{13} \\ R_{21} & R_{22} & R_{23} \\ R_{31} & R_{32} & R_{33} \end{bmatrix} R=⎣⎡R11R21R31R12R22R32R13R23R33⎦⎤ 可以将此矩阵考虑为三个旋转序列,每个旋转轴绕一个主轴旋转。由于矩阵乘法不满足交换律,因此绕轴旋转的顺序会影响结果。对于此分析,我们将首先绕x轴旋转,然后绕y轴旋转,最后绕z轴旋转。 这样的旋转序列可以表示为矩阵乘积, R = R z ( ϕ ) R y ( θ ) R x ( ψ ) = [ cos θ cos ϕ sin ψ sin θ cos ϕ − cos ψ sin ϕ cos ψ sin θ cos ϕ + sin ψ sin ϕ cos θ sin ϕ sin ψ sin θ sin ϕ + cos ψ cos ϕ cos ψ sin θ sin ϕ − sin ψ cos ϕ − sin θ sin ψ cos θ cos ψ cos θ ] \begin{alignedat}{2} R = R_z(\phi)R_y(\theta)R_x(\psi) \\ &=\begin{bmatrix} \cos \theta \cos \phi & \sin \psi \sin \theta \cos \phi-\cos \psi \sin \phi & \cos \psi \sin \theta \cos \phi+\sin \psi \sin \phi \\ \cos \theta \sin \phi & \sin \psi \sin \theta \sin \phi+\cos \psi \cos \phi & \cos \psi \sin \theta \sin \phi-\sin \psi \cos \phi \\ -\sin \theta & \sin \psi \cos \theta & \cos \psi \cos \theta \end{bmatrix} \end{alignedat} R=Rz(ϕ)Ry(θ)Rx(ψ)=⎣⎡cosθcosϕcosθsinϕ−sinθsinψsinθcosϕ−cosψsinϕsinψsinθsinϕ+cosψcosϕsinψcosθcosψsinθcosϕ+sinψsinϕcosψsinθsinϕ−sinψcosϕcosψcosθ⎦⎤ 给定一个旋转矩阵 R R R,我们可以通过将 R R R每个元素与矩阵乘积 R z ( ϕ ) R y ( θ ) R x ( ϕ ) R_z(\phi)R_y(\theta)R_x(\phi) Rz(ϕ)Ry(θ)Rx(ϕ)对应元素相等计算欧拉角 ψ , θ , ϕ \psi, \theta, \phi ψ,θ,ϕ。这将得到九个方程,可用于找到欧拉角。 Finding two possible angles for θ \theta θ由 R 31 R_{31} R31,我们得到 R 31 = − sin θ R_{31} = - \sin \theta R31=−sinθ 对等式求反得到 θ = − a s i n ( R 31 ) (1) \theta = - \mathrm{asin}(R_{31}) \tag{1} θ=−asin(R31)(1) 然而,对等式(1)解释的时候应该注意到 sin ( π − θ ) = sin θ \sin (\pi - \theta)=\sin \theta sin(π−θ)=sinθ,因此有两个不同的 θ \theta θ都满足等式(1)(备注:除了 θ = ± π / 2 \theta= \pm \pi /2 θ=±π/2(即 R 31 = ± 1 R_{31}=\pm1 R31=±1))。因此 θ \theta θ有两个有效的解。 θ 1 = − a s i n ( R 31 ) θ 2 = π − θ 1 = π + a s i n ( R 31 ) \begin{aligned} \theta_1 &= - \mathrm{asin}(R_{31}) \\ \theta_2 &= \pi - \theta_1 = \pi + \mathrm{asin}(R_{31}) \end{aligned} θ1θ2=−asin(R31)=π−θ1=π+asin(R31) 接下来的报告中,我们将单独处理 R 31 = ± 1 R_{31}= \pm 1 R31=±1的情况。因此,通过利用 R 31 R_{31} R31元素的值,我们可以确定 θ \theta θ的两个不同的值。 Find the corresponding angles of ψ \psi ψ为了找到 ψ \psi ψ的值,我们观察到 R 32 R 33 = tan ( ψ ) \frac{R_{32}}{R_{33}} = \tan(\psi) R33R32=tan(ψ) 我们使用该等式解 ψ \psi ψ,有 ψ = a t a n 2 ( R 32 , R 33 ) (2) \psi = \mathrm{atan2}(R_{32}, R_{33}) \tag{2} ψ=atan2(R32,R33)(2) 其中 a t a n 2 ( y , x ) \mathrm{atan2}(y, x) atan2(y,x)表示变量 x , y x, y x,y的反正切,它类似于计算y / x的反正切,不同之处在于,两个自变量的符号都用于确定结果的象限,该象限在[-π,π]范围内。函数 a t a n 2 \mathrm{atan2} atan2在很多程序语言中都有实现。 在解释等式(2)时我们注意到,当 cos θ > 0 \cos \theta \gt 0 cosθ>0时, ψ = a t a n ( R 32 , R 33 ) \psi = \mathrm{atan(R_{32}, R_{33})} ψ=atan(R32,R33),然而,当 cos ψ < 0 \cos \psi \lt 0 cosψ |
今日新闻 |
推荐新闻 |
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 |